--= Default Minetest

-- Wood

if minetest.get_modpath("default") then
	stairs.register_all("wood", "default:wood",
		{choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
		{"default_wood.png"},
		"Wooden",
		nil, false)

	stairs.register_all("junglewood", "default:junglewood",
		{choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
		{"default_junglewood.png"},
		"Jungle Wood",
		nil, false)

	stairs.register_all("pine_wood", "default:pinewood",
		{choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
		{"default_pine_wood.png"},
		"Pine Wood",
		nil, false)

	-- Register aliases for new pine node names
	minetest.register_alias("stairs:stair_pinewood", "stairs:stair_pine_wood")
	minetest.register_alias("stairs:slab_pinewood", "stairs:slab_pine_wood")

	stairs.register_all("acacia_wood", "default:acacia_wood",
		{choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
		{"default_acacia_wood.png"},
		"Acacia Wood",
		nil, false)

	stairs.register_all("aspen_wood", "default:aspen_wood",
		{choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
		{"default_aspen_wood.png"},
		"Aspen Wood",
		nil, false)

	-- Stone

	stairs.register_all("stone", "default:stone",
		{cracky = 3},
		{"default_stone.png"},
		"Stone",
		nil, true)

	stairs.register_all("stonebrick", "default:stonebrick",
		{cracky = 2},
		{"default_stone_brick.png"},
		"Stone Brick",
		nil, false)

	stairs.register_all("stone_block", "default:stone_block",
		{cracky = 2},
		{"default_stone_block.png"},
		"Stone Block",
		nil, true)

	stairs.register_all("cobble", "default:cobble",
		{cracky = 3},
		{"default_cobble.png"},
		"Cobble",
		nil, true)

	stairs.register_all("mossycobble", "default:mossycobble",
		{cracky = 3},
		{"default_mossycobble.png"},
		"Mossy Cobble",
		nil, true)

	stairs.register_all("desert_stone", "default:desert_stone",
		{cracky = 3},
		{"default_desert_stone.png"},
		"Desert Stone",
		nil, true)

	stairs.register_all("desert_stonebrick", "default:desert_stonebrick",
		{cracky = 2},
		{"default_desert_stone_brick.png"},
		"Desert Stone Brick",
		nil, false)

	stairs.register_all("desert_stone_block", "default:desert_stone_block",
		{cracky = 2},
		{"default_desert_stone_block.png"},
		"Desert Stone Block",
		nil, true)

	stairs.register_all("desert_cobble", "default:desert_cobble",
		{cracky = 3},
		{"default_desert_cobble.png"},
		"Desert Cobble",
		nil, true)

	-- Sandstone

	stairs.register_all("sandstone", "default:sandstone",
		{crumbly = 1, cracky = 3},
		{"default_sandstone.png"},
		"Sandstone",
		nil, true)

	stairs.register_all("sandstonebrick", "default:sandstonebrick",
		{cracky = 2},
		{"default_sandstone_brick.png"},
		"Sandstone Brick",
		nil, false)

	stairs.register_all("sandstone_block", "default:sandstone_block",
		{cracky = 2},
		{"default_sandstone_block.png"},
		"Sandstone Block",
		nil, true)

	stairs.register_all("desert_sandstone", "default:desert_sandstone",
		{crumbly = 1, cracky = 3},
		{"default_desert_sandstone.png"},
		"Desert Sandstone",
		nil, true)

	stairs.register_all("desert_sandstone_brick", "default:desert_sandstone_brick",
		{cracky = 2},
		{"default_desert_sandstone_brick.png"},
		"Desert Sandstone Brick",
		nil, false)

	stairs.register_all("desert_sandstone_block", "default:desert_sandstone_block",
		{cracky = 2},
		{"default_desert_sandstone_block.png"},
		"Desert Sandstone Block",
		nil, true)

	stairs.register_all("silver_sandstone", "default:silver_sandstone",
		{crumbly = 1, cracky = 3},
		{"default_silver_sandstone.png"},
		"Silver Sandstone",
		nil, true)

	stairs.register_all("silver_sandstone_brick", "default:silver_sandstone_brick",
		{cracky = 2},
		{"default_silver_sandstone_brick.png"},
		"Silver Sandstone Brick",
		nil, false)

	stairs.register_all("silver_sandstone_block", "default:silver_sandstone_block",
		{cracky = 2},
		{"default_silver_sandstone_block.png"},
		"Silver Sandstone Block",
		nil, true)

	-- Obsidian

	stairs.register_all("obsidian", "default:obsidian",
		{cracky = 1, level = 2},
		{"default_obsidian.png"},
		"Obsidian",
		nil, true)

	stairs.register_all("obsidianbrick", "default:obsidianbrick",
		{cracky = 1, level = 2},
		{"default_obsidian_brick.png"},
		"Obsidian Brick",
		nil, false)

	stairs.register_all("obsidian_block", "default:obsidian_block",
		{cracky = 1, level = 2},
		{"default_obsidian_block.png"},
		"Obsidian block",
		nil, true)

	-- Cloud (with overrides)

	stairs.register_stair("cloud", "default:cloud",
		{unbreakable = 1, not_in_creative_inventory = 1},
		{"default_cloud.png"},
		"Cloud Stair",
		nil)

	minetest.override_item("stairs:stair_cloud", {
		on_blast = function() end,
		on_drop = function(itemstack, dropper, pos) end,
		drop = {},
	})

	stairs.register_slab("cloud", "default:cloud",
		{unbreakable = 1, not_in_creative_inventory = 1},
		{"default_cloud.png"},
		"Cloud Slab",
		nil)

	minetest.override_item("stairs:slab_cloud", {
		on_blast = function() end,
		on_drop = function(itemstack, dropper, pos) end,
		drop = {},
	})

	-- Ores

	stairs.register_all("coal", "default:coalblock",
		{cracky = 3},
		{"default_coal_block.png"},
		"Coal",
		nil, true)

	stairs.register_all("steelblock", "default:steelblock",
		{cracky = 1, level = 2},
		{"default_steel_block.png"},
		"Steel",
		nil, true)

	stairs.register_all("copperblock", "default:copperblock",
		{cracky = 1, level = 2},
		{"default_copper_block.png"},
		"Copper",
		nil, true)

	stairs.register_all("bronzeblock", "default:bronzeblock",
		{cracky = 1, level = 2},
		{"default_bronze_block.png"},
		"Bronze",
		nil, true)

	stairs.register_all("tinblock", "default:tinblock",
		{cracky = 1, level = 2},
		{"default_tin_block.png"},
		"Tin",
		nil, true)

	stairs.register_all("mese", "default:mese",
		{cracky = 1, level = 2},
		{"default_mese_block.png"},
		"Mese",
		nil)

	stairs.register_all("goldblock", "default:goldblock",
		{cracky = 1},
		{"default_gold_block.png"},
		"Gold",
		nil)

	stairs.register_all("diamondblock", "default:diamondblock",
		{cracky = 1, level = 3},
		{"default_diamond_block.png"},
		"Diamond",
		nil)

	-- Setting to show glass stair sides
	local gsides = minetest.settings:get_bool("stairs.glass_sides") ~= false

	-- Old glass stairs
	--stairs.register_all("glass", "default:glass",
	--	{cracky = 3, oddly_breakable_by_hand = 3},
	--	{"default_glass.png"},
	--	"Glass",
	--	stairs.glass)

	-- Glass (stairs registered seperately to use special texture)

	local face_tex = "default_glass.png"
	local side_tex = gsides and "stairs_glass_quarter.png" or face_tex

	stairs.register_stair(
		"glass",
		"default:glass",
		{cracky = 3, oddly_breakable_by_hand = 3},
		{side_tex, face_tex, side_tex, side_tex, face_tex, side_tex},
		"Glass Stair",
		nil,
		false
	)

	stairs.register_slab(
		"glass",
		"default:glass",
		{cracky = 3, oddly_breakable_by_hand = 3},
		{face_tex, face_tex, side_tex},
		"Glass Slab",
		nil,
		false
	)

	stairs.register_stair_inner(
		"glass",
		"default:glass",
		{cracky = 3, oddly_breakable_by_hand = 3},
		{side_tex, face_tex, side_tex, face_tex, face_tex, side_tex},
		"",
		nil,
		false,
		"Inner Glass Stair"
	)

	stairs.register_stair_outer(
		"glass",
		"default:glass",
		{cracky = 3, oddly_breakable_by_hand = 3},
		{side_tex, face_tex, side_tex, side_tex, side_tex, side_tex},
		"",
		nil,
		false,
		"Outer Glass Stair"
	)

	stairs.register_slope(
		"glass",
		"default:glass",
		{cracky = 3, oddly_breakable_by_hand = 3},
		{face_tex},
		"Glass Slope",
		nil
	)

	stairs.register_slope_inner(
		"glass",
		"default:glass",
		{cracky = 3, oddly_breakable_by_hand = 3},
		{face_tex},
		"Glass Inner Slope",
		nil
	)

	stairs.register_slope_outer(
		"glass",
		"default:glass",
		{cracky = 3, oddly_breakable_by_hand = 3},
		{face_tex},
		"Glass Outer Slope",
		nil
	)

	-- Old obsidian glass stairs
	--stairs.register_all("obsidian_glass", "default:obsidian_glass",
	--	{cracky = 2},
	--	{"default_obsidian_glass.png"},
	--	"Obsidian Glass",
	--	stairs.glass)

	-- Obsidian Glass (stairs registered seperately to use special texture)

	face_tex = "default_obsidian_glass.png"
	side_tex = gsides and "stairs_obsidian_glass_quarter.png" or face_tex

	stairs.register_stair(
		"obsidian_glass",
		"default:obsidian_glass",
		{cracky = 2},
		{side_tex, face_tex, side_tex, side_tex, face_tex, side_tex},
		"Obsidian Glass Stair",
		nil,
		false
	)

	stairs.register_slab(
		"obsidian_glass",
		"default:obsidian_glass",
		{cracky = 2},
		{face_tex, face_tex, side_tex},
		"Obsidian Glass Slab",
		nil,
		false
	)

	stairs.register_stair_inner(
		"obsidian_glass",
		"default:obsidian_glass",
		{cracky = 2},
		{side_tex, face_tex, side_tex, face_tex, face_tex, side_tex},
		"",
		nil,
		false,
		"Inner Obsidian Glass Stair"
	)

	stairs.register_stair_outer(
		"obsidian_glass",
		"default:obsidian_glass",
		{cracky = 2},
		{side_tex, face_tex, side_tex, side_tex, side_tex, side_tex},
		"",
		nil,
		false,
		"Outer Obsidian Glass Stair"
	)

	stairs.register_slope(
		"obsidian_glass",
		"default:obsidian_glass",
		{cracky = 2},
		{face_tex},
		"Obsidian Glass Slope",
		nil
	)

	stairs.register_slope_inner(
		"obsidian_glass",
		"default:obsidian_glass",
		{cracky = 2},
		{face_tex},
		"Obsidian Glass Inner Slope",
		nil
	)

	stairs.register_slope_outer(
		"obsidian_glass",
		"default:obsidian_glass",
		{cracky = 2},
		{face_tex},
		"Obsidian Glass Outer Slope",
		nil
	)

	-- Brick, Snow and Ice

	stairs.register_all("brick", "default:brick",
		{cracky = 3},
		{"default_brick.png"},
		"Brick",
	nil, false)

	stairs.register_all("snowblock", "default:snowblock",
		{crumbly = 3, cools_lava = 1, snowy = 1},
		{"default_snow.png"},
		"Snow Block",
		nil, true)

	stairs.register_all("ice", "default:ice",
		{cracky = 3, cools_lava = 1},
		{"default_ice.png"},
		"Ice",
		nil, true)
end

-- More Ores mod

if minetest.get_modpath("moreores") then

	stairs.register_all("silver_block", "moreores:silver_block",
		{cracky = 1, level = 2},
		{"moreores_silver_block.png"},
		"Silver",
		nil, true)

	stairs.register_all("mithril_block", "moreores:mithril_block",
		{cracky = 1, level = 2},
		{"moreores_mithril_block.png"},
		"Mithril",
		nil, true)
end

-- Mobs mod

if minetest.registered_nodes["mobs:cheeseblock"] then

	stairs.register_all("cheeseblock", "mobs:cheeseblock",
		{crumbly = 3, flammable = 2},
		{"mobs_cheeseblock.png"},
		"Cheese Block",
		nil)

	stairs.register_all("honey_block", "mobs:honey_block",
		{crumbly = 3, flammable = 2},
		{"mobs_honey_block.png"},
		"Honey Block",
		nil)
end

-- Lapis mod

if minetest.get_modpath("lapis") then

	stairs.register_all("lapis_block", "lapis:lapis_block",
		{cracky = 3},
		{"lapis_block_side.png"},
		"Lapis",
		nil)

	stairs.register_all("lapis_brick", "lapis:lapis_brick",
		{cracky = 3},
		{"lapis_brick.png"},
		"Lapis Brick",
		nil)

	stairs.register_all("lapis_cobble", "lapis:lapis_cobble",
		{cracky = 3},
		{"lapis_cobble.png"},
		"Lapis Cobble",
		nil)
end

-- Homedecor mod

if minetest.get_modpath("homedecor_roofing") then

	stairs.register_all("shingles_asphalt", "homedecor:shingles_asphalt",
		{snappy = 3},
		{"homedecor_shingles_asphalt.png"},
		"Asphalt Shingle",
		nil)

	stairs.register_all("shingles_terracotta", "homedecor:shingles_terracotta",
		{snappy = 3},
		{"homedecor_shingles_terracotta.png"},
		"Terracotta Shingle",
		nil)

	stairs.register_all("shingles_wood", "homedecor:shingles_wood",
		{snappy = 3},
		{"homedecor_shingles_wood.png"},
		"Wooden Shingle",
		nil)
end

-- Xanadu mod

if minetest.get_modpath("xanadu") then

	stairs.register_all("stained_wood_white", "xanadu:stained_wood_white",
		{choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
		{"stained_wood_white.png"},
		"White Wooden",
		nil, false)

	stairs.register_all("stained_wood_red", "xanadu:stained_wood_red",
		{choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
		{"stained_wood_red.png"},
		"Red Wooden",
		nil, false)

	stairs.register_all("stone1", "xanadu:stone1",
		{cracky = 3},
		{"stone1.png"},
		"Decorative Stone 1",
		nil)

	stairs.register_all("stone2", "xanadu:stone2",
		{cracky = 3},
		{"stone2.png"},
		"Decorative Stone 2",
		nil)

	stairs.register_all("stone3", "xanadu:stone3",
		{cracky = 3},
		{"stone3.png"},
		"Decorative Stone 3",
		nil)

	stairs.register_all("stone4", "xanadu:stone4",
		{cracky = 3},
		{"stone4.png"},
		"Decorative Stone 4",
		nil)

	stairs.register_all("stone5", "xanadu:stone5",
		{cracky = 3},
		{"stone5.png"},
		"Decorative Stone 5",
		nil)

	stairs.register_all("stone6", "moreblocks:stone_tile",--"xanadu:stone6",
		{cracky = 3},
		{"stone6.png"},
		"Decorative Stone 6",
		nil)

	stairs.register_all("sandstonebrick1", "xanadu:sandstonebrick1",
		{cracky = 3},
		{"sandstonebrick1.png"},
		"Decorative Sandstone 1",
		nil)

	stairs.register_all("sandstonebrick2", "xanadu:sandstonebrick2",
		{cracky = 3},
		{"sandstonebrick2.png"},
		"Decorative Sandstone 2",
		nil)

	stairs.register_all("sandstonebrick4", "xanadu:sandstonebrick4",
		{cracky = 3},
		{"sandstonebrick4.png"},
		"Decorative Sandstone 4",
		nil)

	stairs.register_slab("desert_cobble1", "xanadu:desert_cobble1",
		{cracky = 3},
		{"desert_cobble1.png"},
		"Decorative desert cobble 1 slab",
		nil)

	stairs.register_slab("desert_cobble5", "xanadu:desert_cobble5",
		{cracky = 3},
		{"desert_cobble5.png"},
		"Decorative desert cobble 5 slab",
		nil)

	stairs.register_slab("desert_stone1", "xanadu:desert_stone1",
		{cracky = 3},
		{"desert_stone1.png"},
		"Decorative desert stone 1 slab",
		nil)

	stairs.register_slab("desert_stone3", "xanadu:desert_stone3",
		{cracky = 3},
		{"desert_stone3.png"},
		"Decorative desert stone 3 slab",
		nil)

	stairs.register_slab("desert_stone4", "xanadu:desert_stone4",
		{cracky = 3},
		{"desert_stone4.png"},
		"Decorative desert stone 4 slab",
		nil)

	stairs.register_stair("desert_stone4", "xanadu:desert_stone4",
		{cracky = 3},
		{"desert_stone4.png"},
		"Decorative desert stone 4 stair",
		nil)

	stairs.register_slab("desert_stone5", "xanadu:desert_stone5",
		{cracky = 3},
		{"desert_stone5.png"},
		"Decorative desert stone 5 slab",
		nil)

	stairs.register_slab("red1", "xanadu:red1",
		{cracky = 3},
		{"baked_clay_red1.png"},
		"Decorative baked red clay 1 slab",
		nil)

	stairs.register_all("bred2", "xanadu:red2",
		{cracky = 3},
		{"baked_clay_red2.png"},
		"Decorative baked red clay 2",
		nil)

	stairs.register_all("compressed_cobble", "xanadu:compressed_cobble",
		{cracky = 3, level = 2},
		{"compressed_cobble.png"},
		"Compressed Cobble",
		nil)

	stairs.register_all("compressed_dirt", "xanadu:compressed_dirt",
		{crumbly = 2},
		{"compressed_dirt.png"},
		"Compressed Dirt",
		nil)

	stairs.register_all("goldblock1", "xanadu:goldblock1",
		{cracky = 1},
		{"gold_block1.png"},
		"Decorative Goldblock 1",
		nil)

	stairs.register_slope("steelblock1", "xanadu:steelblock1",
		{cracky = 1, level = 2},
		{"steel_block1.png"},
		"Decorative Steelblock 1",
		nil)

	stairs.register_slab("steelblock3", "xanadu:steelblock3",
		{cracky = 1, level = 2},
		{"steel_block3.png"},
		"Decorative Steelblock 3",
		nil)

	stairs.register_slope("steelblock5", "xanadu:steelblock5",
		{cracky = 1, level = 2},
		{"steel_block5.png"},
		"Decorative Steelblock 5",
		nil)

	stairs.register_slab("sandstone4", "xanadu:sandstone4",
		{crumbly = 2, cracky = 3},
		{"sandstone4.png"},
		"Decorative sandstone 4 slab",
		nil)
end

-- Castle mod

if minetest.get_modpath("castle_masonry") then

	stairs.register_all("dungeon_stone", "castle:dungeon_stone",
		{cracky = 2},
		{"castle_dungeon_stone.png"},
		"Dungeon",
		nil)

	stairs.register_all("stonewall", "castle:stonewall",
		{cracky = 2},
		{"castle_stonewall.png"},
		"Castle Wall",
		nil)
end

-- Wool mod

if minetest.get_modpath("wool") then

	local colours = {
		{"black", "Black"},
		{"blue", "Blue"},
		{"brown", "Brown"},
		{"cyan", "Cyan"},
		{"dark_green", "Dark Green"},
		{"dark_grey", "Dark Grey"},
		{"green", "Green"},
		{"grey", "Grey"},
		{"magenta", "Magenta"},
		{"orange", "Orange"},
		{"pink", "Pink"},
		{"red", "Red"},
		{"violet", "Violet"},
		{"white", "White"},
		{"yellow", "Yellow"},
	}

	for i = 1, #colours, 1 do

		stairs.register_all("wool_" .. colours[i][1], "wool:" .. colours[i][1],
			{snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, flammable = 3},
			{"wool_" .. colours[i][1] .. ".png"},
			colours[i][2] .. " Wool",
			nil) -- nil to use node's own sounds
	end
end
